package com.weic.easycache.access;

import android.os.Build;

public class NetAcesHelper {
	private static INetAces netAces;
	private static INetAces netAcesGzip;
	private static INetAces netAcesJson;
	private static INetAces netAcesJsonGzip;
	
	/**默认是带Gzip压缩的Json**/
	public static INetAces getDefault() {
		return getForJsonGzip();
	}
	
	/**用于读取未启用Gzip压缩的普通字符串**/
	public static INetAces get() {
		if(netAces == null) {
			if (Build.VERSION.SDK_INT >= 9) {
				netAces = new HttpService_v9u(false, false);
	        } else {
	        	netAces = new HttpService_v8(false, false);
	        }
		}
		return netAces;
	}

	/**用于读取启用了Gzip压缩的普通字符串**/
	public static INetAces getForGzip() {
		if(netAcesGzip == null) {
			if (Build.VERSION.SDK_INT >= 9) {
				netAcesGzip = new HttpService_v9u(false, true);
	        } else {
	        	netAcesGzip = new HttpService_v8(false, true);
	        }
		}
		return netAcesGzip;
	}

	/**用于读取未启用Gzip压缩的Json字符串**/
	public static INetAces getForJson() {
		if(netAcesJson == null) {
			if (Build.VERSION.SDK_INT >= 9) {
				netAcesJson = new HttpService_v9u(true, false);
	        } else {
	        	netAcesJson = new HttpService_v8(true, false);
	        }
		}
		return netAcesJson;
	}

	/**用于读取带Gzip压缩的Json**/
	public static INetAces getForJsonGzip() {
		if(netAcesJsonGzip == null) {
			if (Build.VERSION.SDK_INT >= 9) {
				netAcesJsonGzip = new HttpService_v9u(true, true);
	        } else {
	        	netAcesJsonGzip = new HttpService_v8(true, true);
	        }
		}
		return netAcesJsonGzip;
	}
}
